package chapter3;

/**
 * @author Hang
 * @date 2022/8/24
 * @project AutumnOffer
 * @description 面试题17
 **/
public class printNumbers {
    public static void main(String[] args) {
        System.out.println(printNumbers(3));
    }
    public static int[] printNumbers(int n) {
        int count = 0; //记录最大数字
        while(n>0){
            count = count *10 + 9;
            n--;
        }
        int[] res = new int[count];//定义返回数组
        for(int i=1;i<=count;i++){
            res[i-1] = i; //依次赋值
        }
        return res;
    }
}
